<script setup>
defineProps({
  color: {
    type: String,
    default: '#333'
  },
  fruitList: {
    type: Array,
    default: () => []
  },
  title: {
    type: String,
    default: ''
  }
})
</script>

<template>
  <div class="category-bottom">
    <div class="category-bottom-item title">
      <div class="line"></div>
      <div :style="{color:color}" class="category-bottom-title">{{ title }}</div>
      <div class="line"></div>
    </div>
    <div class="category-bottom-item  content">
      <div v-for="(item,index) in fruitList" :key="index" class="content-item">
        <div class="top">
          <router-link :to="`/detail?id=${item.id}`" class="img">
            <img :src="item.img" class="img-item">
          </router-link>
        </div>
        <div class="bottom">
          <div style="font-weight: bold;font-size: larger;margin-top: 15px">{{ item.name }}</div>
          <div style="padding: 0 5px">{{ item.desc }}</div>
          <el-button :color="'#333'" bg plain round style="width: 100px">详细</el-button>
        </div>
      </div>
    </div>
    <div>
      <el-button :color="color" round
                 style="width: 150px;height:40px;color: #ffffff;margin-top: 50px;font-size: 18px;font-weight: bold">
        查看更多
      </el-button>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.category-bottom {
  width: 100%;
  background-color: $fruit-category-bottom-bg-color;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
  gap: 30px;

  &-item {
    width: 100%;
  }

  &-title {
    color: $fruit-category-bottom-title;
    font-size: 24px;
    font-weight: bold;
  }

  .title {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }

  .line {
    width: 40%;
    border-top: 5px dotted #333333;
  }

  .content {
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;

    &-item {
      width: 280px;
      height: 350px;
      background-color: $fruit-category-bottom-item-bg-color;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 10px;
      border-radius: 10px;
      overflow: hidden;
      //padding-bottom: 20px;
      .top {
        width: 100%;
        height: 200px;
        overflow: hidden;
        .img {
          width: 100%;
          height: 100%;
          transition: all 0.2s ease-in-out;

          &-item {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: all 0.2s ease-in-out;
            background-color: #fff;
            &:hover {
              transform: scale(1.3) !important;
            }
          }
        }
      }

      .bottom {
        flex: 1;
        display: flex;
        justify-content: space-around;
        align-items: center;
        gap: 10px;
        flex-direction: column;
        width: 100%;
        padding-bottom: 10px;
      }
    }
  }
}
</style>